home *** CD-ROM | disk | FTP | other *** search
Wrap
property pSprite, pActive, pAction, pVideoSprite on getBehaviorDescription vDesc = "QT CONTROL BUTTON" & RETURN & RETURN vDesc = vDesc & "Use this behavior to make almost any sprite into a control" vDesc = vDesc && "button for Quicktime video sprites. Standard controls" vDesc = vDesc && "available through this behavior are Play, Stop/Pause," vDesc = vDesc && "Rewind to beginning, Jump to End, Fast Forward (2x)" vDesc = vDesc && "and Fast backward (2x). Drag behavior onto a sprite," vDesc = vDesc && "select the Quicktime sprite to control, and which action" vDesc = vDesc && "the button will perform." & RETURN & RETURN vDesc = vDesc & "PARAMETERS:" & RETURN vDesc = vDesc & " - which Quicktime video sprite to control" & RETURN vDesc = vDesc & " - Button action (rewind, stop, play," vDesc = vDesc && "end, backward, forward)" & RETURN & RETURN vDesc = vDesc & "PERMITTED TYPES:" & RETURN vDesc = vDesc & " - Quicktime video to control" & RETURN vDesc = vDesc & " - any graphics sprite(s) for the controls" & RETURN return vDesc end on getBehaviorTooltip vTip = "Create custom Quicktime sprite video control" & RETURN vTip = vTip & "buttons. First place the QuickTime sprite on stage," & RETURN vTip = vTip & "then attach the behavior to the sprites that will " & RETURN vTip = vTip & "serve as the controls." return vTip end on beginSprite me mInitialize(me) end on mouseDown me mVideoButton(me) end on mouseUp me case pAction of #backward, #forward: mVideoButton(me) end case end on mouseLeave me case pAction of #backward, #forward: mVideoButton(me) end case end on mInitialize me pSprite = sprite(me.spriteNum) pActive = 0 end on mVideoButton me if mVerifyVideo(pVideoSprite) then case pAction of #play: sprite(pVideoSprite).movieRate = 1 #stop: sprite(pVideoSprite).movieRate = 0 #rewind: sprite(pVideoSprite).movieRate = 0 sprite(pVideoSprite).movieTime = 0 #end: sprite(pVideoSprite).movieRate = 0 sprite(pVideoSprite).movieTime = sprite(pVideoSprite).member.duration #backward: if the mouseDown and rollOver(me.spriteNum) then pActive = 1 sprite(pVideoSprite).movieRate = -2 else if pActive then sprite(pVideoSprite).movieRate = 0 end if pActive = 0 end if #forward: if the mouseDown and rollOver(me.spriteNum) then pActive = 1 sprite(pVideoSprite).movieRate = 2 else if pActive then sprite(pVideoSprite).movieRate = 0 end if pActive = 0 end if end case end if end on mVerifyVideo vSpriteNum return sprite(vSpriteNum).member.type = #quickTimeMedia end on mVideoSpriteList vVideoList = [] repeat with i = 1 to the lastChannel if mVerifyVideo(i) then add(vVideoList, i) end if end repeat return vVideoList end on mErrorAlert me, vError, vData vBehaviorname = string(me) delete word 1 of vBehaviorname delete char -30001 of vBehaviorname delete char -30001 of vBehaviorname case vData.ilk of #void: vData = "<void>" #symbol: vData = "#" & vData end case case vError of #getPDLError: beep() return [#getPDLError: [#comment: "CANCEL: Sprite MUST be one of the following member types:" & RETURN & vData, #format: #symbol, #range: [#Cancel], #default: #Cancel]] #noVideo: alert("No video sprites are currently on the screen") end case end on getPropertyDescriptionList me if not (the currentSpriteNum) then exit end if vVideos = mVideoSpriteList() if not vVideos.count then return mErrorAlert(me, #noVideo) else vPDList = [:] setaProp(vPDList, #pVideoSprite, [#comment: "Video sprite channel", #format: #string, #default: vVideos[1], #range: vVideos]) setaProp(vPDList, #pAction, [#comment: "Video button action", #format: #symbol, #default: #play, #range: [#rewind, #stop, #play, #end, #backward, #forward]]) return vPDList end if end